package com.hmall.common.client;

import com.hmall.common.pojo.Address;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@FeignClient(value = "userservice")
@Component
public interface UserClient {
    /**
     * 根据addressId查询user-service服务，获取地址信息
     * @param id
     * @return
     */
    @GetMapping("/address/{id}")
    Address getAddressId(@PathVariable("id") Long id);

    /**
     * 根据用户id查询地址列表
     * @param userId
     * @return
     */
    @GetMapping("/address/uid/{userId}")
    List<Address> findAddressByUserId(@PathVariable("userId") Long userId);
}
